﻿import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    width: screenWidth
    height: 150

    Item{
        id:backGround
        anchors.fill: parent
    }

    property real currentPanel: 0

    Rectangle{
        anchors.top: backGround.top
        anchors.topMargin: 1620
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 1060
        height: 150

        Row{
            anchors.verticalCenter: parent.verticalCenter
            spacing: 1
            Repeater{
                model:6

                Rectangle{
                    id:switchBtn
                    width: 175
                    height: 120
                    radius: 10
                    enabled: parameterSettingPanel.bottomSwitchBtnEnabled
                    color: enabled === false? "lightgray" : "#3085f6"

                    Text{
                        anchors.centerIn: parent
                        font.pixelSize: 30
                        font.bold: true
                        color: "white"
                        text:{index === 0 ? "常用参数":
                            index === 1 ? "待命点设置":
                            index === 2 ? "原点设置":
                            index === 3 ? "限位设置":
                            index === 4 ? "补偿设置":
                                       "零点设置"}
                    }

                    MouseArea{
                        anchors.fill: parent

                        onPressed: {
                            parent.color = "#e44034"
                        }

                        onReleased: {
                            parent.color = "#3085f6"
                            currentPanel = index
                            // console.log(currentPanel)
                            if(currentPanel === 0)
                            {
                                commonSettingPanel.visible = true
                                standbySettingPanel.visible = false
                                originSettingPanel.visible = false
                                limitSettingPanel.visible = false
                                compensateSettingPanel.visible = false
                                zeroSettingPanel.visible = false

                                Cpp_Connect.setQmlPage(8);

                            }
                            else if(currentPanel === 1)
                            {
                                commonSettingPanel.visible = false
                                standbySettingPanel.visible = true
                                originSettingPanel.visible = false
                                limitSettingPanel.visible = false
                                compensateSettingPanel.visible = false
                                zeroSettingPanel.visible = false

                                Cpp_Connect.setQmlPage(9);
                            }
                            else if(currentPanel === 2)
                            {
                                commonSettingPanel.visible = false
                                standbySettingPanel.visible = false
                                originSettingPanel.visible = true
                                limitSettingPanel.visible = false
                                compensateSettingPanel.visible = false
                                zeroSettingPanel.visible = false

                                Cpp_Connect.setQmlPage(10);
                            }
                            else if(currentPanel === 3)
                            {
                                commonSettingPanel.visible = false
                                standbySettingPanel.visible = false
                                originSettingPanel.visible = false
                                limitSettingPanel.visible = true
                                compensateSettingPanel.visible = false
                                zeroSettingPanel.visible = false

                                Cpp_Connect.setQmlPage(11);
                            }
                            else if(currentPanel === 4)
                            {
                                commonSettingPanel.visible = false
                                standbySettingPanel.visible = false
                                originSettingPanel.visible = false
                                limitSettingPanel.visible = false
                                compensateSettingPanel.visible = true
                                zeroSettingPanel.visible = false

                                Cpp_Connect.setQmlPage(12);
                            }
                            else if(currentPanel === 5)
                            {
                                commonSettingPanel.visible = false
                                standbySettingPanel.visible = false
                                originSettingPanel.visible = false
                                limitSettingPanel.visible = false
                                compensateSettingPanel.visible = false
                                zeroSettingPanel.visible = true

                                Cpp_Connect.setQmlPage(13);
                            }

                        }
                    }
                }
            }
        }
    }
}
